package de.mp3player.helpers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class LNFSetter implements ActionListener{
	
	private String lnfName;
	private JRadioButton thisButton;
	private JFrame frame;
	protected JRadioButton prevButton;
	
	public LNFSetter(String lnfName, JRadioButton thisButton, JFrame frame) {
		super();
		this.lnfName = lnfName;
		this.thisButton = thisButton;
		this.frame = frame;
		this.prevButton = new JRadioButton();
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		try{
			UIManager.setLookAndFeel(lnfName);
			SwingUtilities.updateComponentTreeUI(frame);
			frame.pack();
		} catch (Exception ev){
			JOptionPane.showMessageDialog(null, "setLookandFeel funktioniert nicht: "+ev,
					"UI Failure", JOptionPane.INFORMATION_MESSAGE);
			prevButton.setSelected(true);
		}
		prevButton = thisButton;
		
	}

}
